<?php
class NewsController extends Controller {
	public function actionIndex() {
		$this->render('index');
	}
	
	public function actionCategory($id) {
		$id = (int)$id;
		if( ! $id) 
			throw new CHttpException(404);
		
		$model = PostCategory::model()->findByPk($id);
		if( ! $model) 	
			throw new CHttpException(404);
		
		$this->render('category', array('model' => $model));
	}
	
	public function actionDetail($id) {
		$id = (int)$id;
		if( ! $id) 
			throw new CHttpException(404);
		
		$model = Post::model()->findByPk($id);
		if( ! $model) 	
			throw new CHttpException(404);
		
		$this->render('detail', array('model' => $model));
	}
}